#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<cstring>
#include<unordered_map>

using namespace std;

long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {
    vector<vector<pair<int, int>>> edges(n + 1);

    for (auto it : rides)
        edges[it[1]].push_back({ it[0],it[2] });

    vector<long long> f(n + 1, 0);
    for (int i = 1; i <= n; i++)
    {
        f[i] = f[i - 1];
        for (int j = 0; j < edges[i].size(); j++)
        {
            int s = edges[i][j].first, w = edges[i][j].second;
            f[i] = max(f[i], f[s] + i - s + w);
        }
    }
    return f[n];
}

//int main()
//{
//    vector<vector<int>> vv = { {1,6,1},{3,10,2},{10,12,3},{11,12,2},{12,15,2},{13,18,1} };
//    maxTaxiEarnings(20, vv);
//    return 0;
//}

const int N = 12, M = 1 << N;

int n, m;
long long f[N][M];
bool st[N];

int main()
{
    while (cin >> n >> m, n || m)
    {
        memset(f, 0, sizeof f);

        for (int i = 0; i < 1 << n; i++)
        {
            st[i] = true;
            int cnt = 0;
            for (int j = 0; j < n; j++)
                if (i >> j & 1)
                {
                    if (cnt & 1) st[i] = false;
                    cnt = 0;
                }
                else cnt++;

            if (cnt & 1) st[i] = false;
        }

        f[0][0] = 1;
        for (int i = 1; i <= m; i++)
            for (int j = 0; j < 1 << n; j++)
                for (int k = 0; k < 1 << n; k++)
                    if ((j & k) == 0 && st[j | k])
                        f[i][j] += f[i - 1][k];

        cout << f[m][0] << endl;
    }
    return 0;
}